package com.nbsaas.boot.product.rest.resource;

import com.nbsaas.boot.product.api.apis.SpecApi;
import com.nbsaas.boot.product.data.entity.Spec;
import com.nbsaas.boot.product.api.domain.request.SpecRequest;
import com.nbsaas.boot.product.api.domain.response.SpecResponse;
import com.nbsaas.boot.product.api.domain.simple.SpecSimple;
import com.nbsaas.boot.product.rest.convert.SpecSimpleConvert;
import com.nbsaas.boot.product.rest.convert.SpecEntityConvert;
import com.nbsaas.boot.product.rest.convert.SpecResponseConvert;
import com.nbsaas.boot.product.data.repository.SpecRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   规格-业务接口实现
*/
@Transactional
@Service
public class SpecResource extends BaseResource<Spec,SpecResponse, SpecSimple, SpecRequest>  implements SpecApi {

    @Resource
    private SpecRepository specRepository;

    @Override
    public JpaRepositoryImplementation<Spec, Serializable> getJpaRepository() {
        return specRepository;
    }

    @Override
    public Function<Spec, SpecSimple> getConvertSimple() {
        return new SpecSimpleConvert();
    }

    @Override
    public Function<SpecRequest, Spec> getConvertForm() {
        return new SpecEntityConvert();
    }

    @Override
    public Function<Spec, SpecResponse> getConvertResponse() {
        return new SpecResponseConvert();
    }




}


